import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'HomePage',
    component:() => import('../views/HomePage.vue')
  },
  {
    path: '/book-list-mn',
    name: 'BookList',
    component:() => import('../views/BookList.vue'),
    props: { default: true, sidebar: false }
  },
  {
    path: '/book-detail-mn',
    name: 'BookDetail',
    component:() => import('../views/BookDetail.vue'),
    props: { default: true, sidebar: false }
  },
  {
    path: '/book-detail-zh',
    name: 'BookDetailZh',
    component:() => import('../components/BookDetailZh.vue'),
    props: { default: true, sidebar: false }
  }
]

const router = new VueRouter({
  routes
})

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

VueRouter.prototype.replace = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

export default router
